<template>
  <div class="home-container">
    <!-- 顶部导航 -->
    <el-header class="main-header" height="80px">
      <div class="header-content">
        <div class="logo-group">
          <span class="logo-text">惠邻农管</span>
          <el-tag type="success" effect="dark">乡村振兴助农平台</el-tag>
        </div>
        <div class="nav-group">
          <el-button type="text">今日团购</el-button>
          <el-button type="text">助农故事</el-button>
          <el-button type="text">冷链溯源</el-button>
        </div>
      </div>
    </el-header>

    <!-- 轮播图区域 -->
    <el-carousel
      :interval="5000"
      height="420px"
      indicator-position="outside"
      class="agriculture-carousel"
    >
      <el-carousel-item v-for="item in 4" :key="item">
        <div class="carousel-content">
          <div class="image-placeholder"></div>
          <div class="carousel-text">
            <h2>新鲜直达餐桌</h2>
            <p>
              来自田间的新鲜美味，{{
                [
                  "24小时极速配送",
                  "农家直供无中间商",
                  "当季鲜果限量抢购",
                  "扶贫助农特惠专场",
                ][item - 1]
              }}
            </p>
          </div>
        </div>
      </el-carousel-item>
    </el-carousel>

    <!-- 特色服务标签 -->
    <div class="feature-tags">
      <el-tag
        v-for="tag in features"
        :key="tag"
        type="info"
        effect="plain"
        class="service-tag"
      >
        <el-icon :size="18" class="tag-icon">
          <component :is="tagIcons[tag]" />
        </el-icon>
        {{ tag }}
      </el-tag>
    </div>

    <!-- 服务保障栏 -->
    <el-row class="service-guarantee">
      <el-col
        v-for="(item, index) in guarantees"
        :key="index"
        :span="6"
        class="guarantee-item"
      >
        <el-icon :size="28" class="guarantee-icon">
          <component :is="item.icon" />
        </el-icon>
        <div class="guarantee-text">
          <h4>{{ item.title }}</h4>
          <p>{{ item.desc }}</p>
        </div>
      </el-col>
    </el-row>
  </div>
</template>

<script setup>
import { ref } from "vue";
import {
  Present,
  Clock,
  Van,
  Coin,
  ScaleToOriginal,
  Sunny,
} from "@element-plus/icons-vue";

const features = ref(["扶贫专享", "冷链直达", "48小时退换", "产地溯源"]);

const tagIcons = {
  扶贫专享: Present,
  冷链直达: ScaleToOriginal,
  "48小时退换": Clock,
  产地溯源: Sunny,
};

const guarantees = ref([
  { icon: Coin, title: "价格透明", desc: "农家直供无中间差价" },
  { icon: Van, title: "极速配送", desc: "当日下单次日送达" },
  { icon: ScaleToOriginal, title: "缺重赔付", desc: "足斤足两承诺" },
  { icon: Present, title: "助农补贴", desc: "政府专项补贴支持" },
]);
</script>

<style scoped>
.home-container {
  background: #f8f9fa;
  min-height: 100vh;
}

.main-header {
  background: #fff;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  height: 100%;
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 15px;
}

.logo-text {
  font-size: 28px;
  font-weight: 600;
  color: #67c23a;
}

.agriculture-carousel {
  max-width: 1200px;
  margin: 20px auto;
  border-radius: 8px;
  overflow: hidden;
}

.carousel-content {
  position: relative;
  height: 100%;
}

.image-placeholder {
  height: 100%;
  background: linear-gradient(45deg, #f0f9eb, #d9f7be);
}

.carousel-text {
  position: absolute;
  bottom: 40px;
  left: 40px;
  color: #333;

  h2 {
    font-size: 32px;
    margin-bottom: 12px;
  }

  p {
    font-size: 18px;
    color: #666;
  }
}

.feature-tags {
  max-width: 1200px;
  margin: 20px auto;
  display: flex;
  gap: 15px;
}

.service-tag {
  padding: 12px 20px;
  font-size: 15px;
  border-radius: 20px;

  .tag-icon {
    vertical-align: middle;
    margin-right: 8px;
  }
}

.product-section {
  max-width: 1200px;
  margin: 30px auto;
  padding: 0 20px;
}

.product-card {
  margin-bottom: 20px;
  transition: transform 0.3s;

  &:hover {
    transform: translateY(-5px);
  }
}

.product-image {
  height: 200px;
  background: #e1f3d8;
  border-radius: 4px;
}

.product-info {
  padding: 15px;
}

.price-group {
  margin: 12px 0;
  display: flex;
  align-items: center;
  gap: 10px;

  .current-price {
    font-size: 20px;
    color: #f56c6c;
    font-weight: 600;
  }

  .original-price {
    color: #999;
    text-decoration: line-through;
  }
}

.stats-group {
  display: flex;
  align-items: center;
  gap: 10px;

  .sold-count {
    color: #666;
    font-size: 13px;
  }

  .progress-bar {
    flex: 1;
  }
}

.service-guarantee {
  max-width: 1200px;
  margin: 40px auto;
  padding: 30px 20px;
  background: #fff;
  border-radius: 8px;
}

.guarantee-item {
  display: flex;
  align-items: center;
  padding: 15px;

  .guarantee-icon {
    color: #67c23a;
    margin-right: 15px;
  }

  h4 {
    margin: 0 0 6px;
    font-size: 16px;
  }

  p {
    margin: 0;
    color: #666;
    font-size: 13px;
  }
}
</style>
